<template>
	<div>
		<headshow msg="最近浏览"></headshow>
		<ul class="list">
			<collectRenct v-for="(peo,index) in list " :key="index" :index="peo.id" :fruitName="peo.foodName" :fruitCon="peo.foodText"
			 :fruitPrice="peo.foodNowMoney" :fruitImg="imgSrc[index]"></collectRenct>
		</ul>
	</div>
</template>

<script>
	//头部小组件
	import headshow from "@/components/headshow.vue";
	// 引入收藏小组件
	import collectRenct from "@/components/collectRenct.vue";
	export default {
		components: {
			headshow,
			collectRenct
		},
		data() {
			return {
				imgSrc: [],
				list: [],
				indexs:null
			};

		},
		methods: {
		},
		mounted() {
			var _this = this;
			var url = "http://localhost:3000";
			this.$axios({
				method: 'post',
				url: 'http://localhost:3000/reactvisit/pa',
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
			}).then((response) => {
				_this.list = response.data.result;
				_this.code = response.data.code;
				window.console.log(_this.list);
				for (var i = 0; i < _this.list.length; i++) {
					this.imgSrc.push(require('../assets/images/' + response.data.result[i].pic));
				}
			}).catch(function(error) {
				_this.data = error;
			});
		},

	}
</script>

<style>
</style>
